﻿using System;
using System.Configuration;

namespace com.hyrentals.dbaccess
{
    public abstract class DBAccessBase
    {
        protected string _connectionString = string.Empty;

        public DBAccessBase()
        {
            Initialize(ConfigurationManager.ConnectionStrings["APPContext"].ConnectionString);
        }

        public DBAccessBase(string connectionString)
        {
            Initialize(connectionString);
        }

        private void Initialize(string connectionString)
        {
            _connectionString = connectionString;
            if (string.IsNullOrEmpty(_connectionString))
            {
                throw new Exception("ConnectionString can't be null or empty");
            }
        }
    }
}
